package antoine.ear.generator.chords;

import java.util.ArrayList;
import java.util.List;

import antoine.ear.exo.Exo;
import antoine.ear.generator.ChordGenerator;
import antoine.ear.generator.NoteGenerator;
import antoine.ear.generator.sequences.Alt7SequenceGenerator;
import antoine.ear.generator.sequences.IonianSequenceGenerator;
import antoine.ear.generator.sequences.MixolydianSequenceGenerator;

public class Maj7Generator extends ChordGenerator {

	public Maj7Generator() {
		this.sequenceGenerator = new IonianSequenceGenerator();
	}
	
	public void reinit(){
		this.sequenceGenerator = new IonianSequenceGenerator();
	}
	
	public List generate(int note, int tick, int delay) {
		List res = new ArrayList();
		this.tonique = note;

		note += 48;
		
		res.add(createNoteOnEvent(note+2, tick));
		res.add(createMetaMessOnEvent(note+2, tick, Exo.ACTIVATENOTE));
		res.add(createMetaMessOnEvent(note+2, tick+delay, Exo.DESACTIVATENOTE));
		res.add(createNoteOnEvent(note+4, tick));
		res.add(createMetaMessOnEvent(note+4, tick, Exo.ACTIVATENOTE));
		res.add(createMetaMessOnEvent(note+4, tick+delay, Exo.DESACTIVATENOTE));
		res.add(createNoteOnEvent(note+7, tick));
		res.add(createMetaMessOnEvent(note+7, tick, Exo.ACTIVATENOTE));
		res.add(createMetaMessOnEvent(note+7, tick+delay, Exo.DESACTIVATENOTE));
		res.add(createNoteOnEvent(note+11, tick));
		res.add(createMetaMessOnEvent(note+11, tick, Exo.ACTIVATENOTE));
		res.add(createMetaMessOnEvent(note+11, tick+delay, Exo.DESACTIVATENOTE));
		res.add(createNoteOffEvent(note+2, tick+delay));
		res.add(createNoteOffEvent(note+4, tick+delay));
		res.add(createNoteOffEvent(note+7, tick+delay));
		res.add(createNoteOffEvent(note+11, tick+delay));
		
		return res;
	}
	
	@Override
	public String chordName() {
		// TODO Auto-generated method stub
		return NoteGenerator.getNoteName(this.tonique)+ "M7";
	}
}
